package org.tote.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.tote.service.user.UserService;

@Controller
@RequestMapping("/math")
public class MathController implements BaseController {

	//private static final String HOME_PAGE_VIEW = "/";

	private static final Logger LOGGER = LoggerFactory.getLogger(MathController.class);
	private static final String MATH_VIEW = "mathEdit";
	private static final String MATH_LIST_VIEW = "mathList";
	public static final String MATH_MAX_PAGE = "mathMaxPage";
	@Autowired
	private UserService userService;

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String initList(Map<String, Object> map) {
		return initList(0, map);
	}

	@RequestMapping(value = "/list/{page}", method = RequestMethod.GET)
	public String initList(@PathVariable("page") int page, Map<String, Object> map) {
		/*
		List<QuizInfo> quizzesInfo = quizService.getQuizzesInfoPage(page, QUIZZES_PER_PAGE);
		boolean more = false;
		if (quizzesInfo.size() > QUIZZES_PER_PAGE) {
			more = true;
			quizzesInfo.subList(QUIZZES_PER_PAGE, quizzesInfo.size()).clear();
		}
		map.put(MATH_INFO_LIST_COMMAND, new QuizInfoListCommand(quizzesInfo, page, more));
		map.put(MATH_MAX_PAGE, quizService.getQuizzesMaxPage(QUIZZES_PER_PAGE));
		map.put(MATH_LIST_COMMAND, new QuizCommand());
		return MATH_LIST_VIEW;
		*/
		return "home";
	}
}
